package org.csmzxy.class2333;

public class 第二题 {
    public static void main(String[] args){
        int sum = sumOfPrimes(100);
        System.out.println("100以内的素数之和是："+sum);

    }
    public static int sumOfPrimes(int limit){
        int sum = 0;
        for (int i=2;i<=limit;i++){
            if (isPrime(i)){
                sum +=1;
            }
        }
        return sum;
    }
    public static boolean isPrime(int num){
        if (num < 2){
            return false;
        }
        for (int i=2;i*i<=num;i++){
            if (num%i == 0){
                return false;
            }
        }
        return true;
    }
}